<%@page import="bll.EnumName"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.*,util.*,dal.*,model.*, bll.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add New Product</title>
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/inputForm.css" />
<link rel="stylesheet" href="css/listForm.css" />
<link rel="stylesheet" href="css/jquery-ui-1.8.14.custom.css" type="text/css" />
<link rel="stylesheet" href="css/hyjack.css" type="text/css" />
<link rel="stylesheet" href="css/datepicker.css" type="text/css" />
<link rel="stylesheet" href="css/themes/ui-lightness/jquery.ui.all.css" />
<link rel="stylesheet" href="css/jquery-ui-timepicker.css" type="text/css" />
<link rel="stylesheet" href="css/jquery-datepicker.css" />
<link rel="stylesheet" href="css/jquery-dialog.css" />

<script language="javascript" type="text/javascript" src="js/datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.select.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.core.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.timepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/datepicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.hyjack.js"></script>
<script language="javascript" type="text/javascript" src="js/ajaxQuickInsert.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.numeric.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.ui.tools.min.js"></script>
<script language="javascript" type="text/javascript" src="js/common.js"></script>


<script language="javascript" type="text/javascript">
$(document).ready(pageLoaded);

function pageLoaded()
{
	//turnOnNumbericInput();
	initTooltip();	
} 

var requiredInputs = [['short_name','short_name_required']];
var intInputs = [];
var doubleInputs = [];
var dateInputs = [];
var timeInputs = [];


function checkInputs() {
	var valid = true;

	if (checkRequiredInputs(requiredInputs) == false) {
		valid = false;
	}

	return valid;
}
	
	
</script>
</head>
<body>
	<div class="divContainer">
		<%@ include file="menu.jsp"%>
				<form id="inputForm" action="product?mode=insert" method="post" onSubmit="return checkInputs()">
					<table class="tblInput">
						<tr >
							<td class="inputHeader">ADD NEW PRODUCT</td>
						</tr>
						<tr>
					<td style="padding-left: 400px; padding-right: 400px;">
						<table cellspacing="0px">
						<tr class="trField">
							<td class="tdFieldName">Short Name</td>
							<td class="tdFieldInput">
								<input class="inputText" type="text" id="short_name" name="short_name" maxlength="25" title="Short name of product. Note: Required"  onblur="validateRequiredInput('short_name');"/>
							</td>
							<td class="tdErrMsg">
								<span id="short_name_required" class="errMsg" style="display: none;" title="Short name is required">(!)</span> 
								
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Full Name</td>
							<td class="tdFieldInput">
								<input class="inputText" type="text" id="full_name" name="full_name" maxlength="255" title="Full name of product" />
							</td>
							<td class="tdErrMsg">
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Foreign Name</td>
							<td class="tdFieldInput">
								<input class="inputText" type="text" id="foreign_name" name="foreign_name" maxlength="255" title="Foreign name of product" />
							</td>
							<td class="tdErrMsg">
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Code</td>
							<td class="tdFieldInput">
								<input class="inputText" type="text" id="code" name="code" maxlength="20" title="Code of product" />
							</td>
							<td class="tdErrMsg">
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Description</td>
							<td class="tdFieldInput">
								<textarea id="description" name="description" rows="5" class="inputTextarea" title="Description for product."></textarea>
							</td>
							<td class="tdErrMsg">
							</td>
						</tr>
						<tr class="trField">
							<td class="tdFieldName">Default Unit</td>
							<td class="tdFieldInput">
								<select id="id_default_unit" name="id_default_unit" class="hyjack" title="Choose an default unit for product.">
									<%=HtmlUtil.<UnitModel>genModelSelect(CacheUtil.getUnitList(), null,Integer.MIN_VALUE, false, true)%>
								</select>
							<input class="btnAdd" type="button" id="addNewUnit" value="" onclick="ajaxAddItem('#id_default_unit', 'unit', 'name', 'Please enter new unit name!');" title="Click here to add new unit."/>
							</td>
							<td class="tdErrMsg">
							</td>
						</tr>
						<tr class="trInputBottom">
							<td class="tdFieldName"></td>
							<td class="tdSubmit"><input class="btnSubmit" type="submit" value="Submit" title="Click to save above information."/></td>

						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
	<%
	
		String urlProductList = "productList.jsp?embedded=true";
	%>
		<jsp:include page='<%=urlProductList%>'></jsp:include>
	</div>
</body>
</html>